package com.bkhech.netty.httpwebsocket.pojo;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Objects;
import java.util.stream.Stream;

/**
 * ChatType
 * 聊天消息类型
 *
 * @author guowm
 * @date 2024-11-13
 */
@Getter
@AllArgsConstructor
public enum ChatType {
    WORDS(3, "文字表情消息"),
    ;

    public final Integer type;
    public final String content;

    public static ChatType getChatType(Integer type) {
        return Stream.of(ChatType.values()).filter(t -> Objects.equals(type, t.type)).findFirst().orElseThrow(() -> new RuntimeException("不存在类型为【" + type + "】的 ChatType"));
    }
}
